home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10783 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.8 KB  |  68 lines

  1. Path: nana.franken.de!wolfgang
  2. Date: 10 Mar 1996 22:16:00 +0200
  3. From: wolfgang@nana.franken.de (Wolfgang Thomas)
  4. Sender: wolfgang@nana.franken.de (Wolfgang Thomas)
  5. Newsgroups: comp.lang.c++
  6. Message-ID: <64cnnJdipZB@nana.franken.de>
  7. Subject: Watcom C++ pecularities
  8. X-Newsreader: CrossPoint v3.1 R/B12245
  9.  
  10. Hello,
  11.  
  12. I have discovered some strange behaviours with C/C++ 10.0A, which
  13. I cannot understand. As I am no expert for C++ it might all be
  14. my fault. Perhaps there are some experienced WATCOM C++ user
  15. who can help me.
  16.  
  17. All the following refers to C/C++ 10.0A and the creation of 32 bit
  18. executables respective DLLs for OS/2.
  19.  
  20. 1.) The following template class compiles and links fine, if the
  21.     class definition and the main function are in the same module.
  22.     If however main is in a different file then the template
  23.     class compiles fine but ends with a linker error
  24.     "near <int near, int near>::Test::Test (char near*) is an undefined
  25.     reference". Why?
  26.  
  27.     template <class KEY, class INFO>
  28.     class Test
  29.     { public: Test (char* f); };
  30.  
  31.     template <class KEY, class INFO>
  32.     Test<KEY, INFO>::Test (char *f)
  33.     { f++; }
  34.  
  35.     void main ()
  36.     { Test<int, int> a(0); }
  37.  
  38.  
  39. 2.) The following structure definition within the private section
  40.     of a class definition causes a compiler error "access to private
  41.     member test::A is not allowed". Why?
  42.  
  43.     class test
  44.     { private: struct A
  45.                {
  46.                   int a;
  47.                   int b;
  48.                };
  49.  
  50.                struct B
  51.                {
  52.                   struct A a;
  53.                   int      c;
  54.                };
  55.     };
  56.  
  57.  
  58. 3.) How can a class be exported within a DLL? The documentation only
  59.     states that for a function an underscore has to be added. But what
  60.     is the naming convention for member functions?
  61.  
  62.  
  63. Thanks for any help.
  64.  
  65. Bye
  66. Wolfgang
  67.  
  68.